package songhq.interview;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;

public class Main {
	
	static Map<String,Integer> results =new HashMap<String,Integer>();
	
	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int arraysLength = in.nextInt();
		int[] arrays = new int[arraysLength];
		for(int i=0;i<arraysLength;i++) {
			arrays[i] = in.nextInt();
		}
		jump(arrays,0,"0");
		int minCount = 0;
		Set<Entry<String, Integer>> entrySet = results.entrySet();
		for (Entry<String, Integer> entry : entrySet) {
			if(minCount ==0 ||minCount > entry.getValue()) {
				minCount = entry.getValue();
			}
		}
		System.out.println(minCount);
	}
	/**
	 * 
	 * @param arrays
	 * @param index 从0开始跳跃 最终的最后一个跳跃满足 arrays[index]+index >= n-1 n为数组的大小
	 * @param history 比如012表示0跳到1再跳到2 ，记录路径
	 */
	public static void jump(int[] arrays, int index, String history) {
		Integer historyCount = results.get(history);
		results.remove(history);//去掉求解路径过程中的记录
		if(historyCount==null) {
			historyCount = 0;
		}
		if(arrays[index]+index >= arrays.length-1) {
			results.put(history+(arrays.length-1), historyCount+1);
		}else {
			for(int i=1;i<= arrays[index];i++) {
				results.put(history+(index+i), historyCount+1);
				//递归
				jump(arrays,index+i,history+(index+i));
			}
		}
	}
}
